import pandas as pd
import matplotlib.pyplot as plt

class VizAgent:
    
    def __init__(self, df: pd.DataFrame):
        self.df = df

    def bar(self, x: str, y: str, title: str = ""):
        plt.figure()
        self.df.plot(kind="bar", x=x, y=y, title=title)
        plt.savefig('bar1.png')

    def line(self, x: str, y: str, title: str = ""):
        plt.figure()
        self.df.plot(kind="line", x=x, y=y, marker="o", title=title)
        plt.savefig('line.png')


    def topk(self, y: str, k: int = 10):
        plt.figure()
        self.df.nlargest(k, y).plot(kind="bar", x=self.df.columns[0], y=y, title=f"Top-{k} by {y}")
        plt.savefig('bar2.png')